{extend name=".././view/create.html" /}

{block name="form"}
    <form class="layui-form layui-form-pane" lay-filter="myform">
          <div class="layui-form-item">
            <label for="zuzhi" class="layui-form-label"><span class="x-red">*</span>组织单位</label>
            <div class="layui-input-block">
              {php} $schoollist = kaoshiSchoolList();{/php}
              <select name="zuzhi_id" lay-verify="required">
                <option value=""></option>
                {volist name="schoollist" id="vo"}
                  <option value="{$vo.id}"
                  {present name="$list.data.zuzhi_id"}
                    {eq name="$list.data.zuzhi_id" value="$vo.id" }
                      selected
                    {/eq}
                  {/present}>
                    {$vo.title}
                  </option>
                {/volist}
              </select>
            </div>
          </div>
          <div class="layui-form-item">
              <label for="title" class="layui-form-label">
                  <span class="x-red">*</span>考试名称
              </label>
              <div class="layui-input-block">
                  <input type="text" id="title" name="title" lay-verify="required"
                  autocomplete="off" class="layui-input " value="{$list.data.title|default=''}" placeholder="2-25个字符">
              </div>
          </div>
          <div class="layui-form-item">
            <label for="xueqi_id" class="layui-form-label"><span class="x-red">*</span>学期</label>
            <div class="layui-input-block">
              {php}
                $xueqi = new \app\teach\model\Xueqi;
                $xueqilist = $xueqi
                      ->limit(6)
                      ->order(['id'=>'desc'])
                      ->field('id,title')
                      ->select();
              {/php}
              <select name="xueqi_id" lay-verify="required">
                <option value=""></option>
                {volist name="xueqilist" id="vo"}
                  <option value="{$vo.id}"
                  {present name="$list.data.xueqi_id"}
                    {eq name="$list.data.xueqi_id" value="$vo.id" }
                      selected
                    {/eq}
                  {/present}>
                    {$vo.title}
                  </option>
                {/volist}
              </select>
            </div>
          </div>
          <div class="layui-form-item">
            <label for="category_id" class="layui-form-label"><span class="x-red">*</span>考试分类</label>
            <div class="layui-input-block">
              {php} $category = categoryChildren(109);{/php}
              <select name="category_id" lay-verify="required">
                <option value=""></option>
                {volist name="category" id="vo"}
                  <option value="{$vo.id}"
                  {present name="$list.data.category_id"}
                    {eq name="$list.data.category_id" value="$vo.id" }
                      selected
                    {/eq}
                  {/present}>
                    {$vo.title}
                  </option>
                {/volist}
              </select>
            </div>
          </div>
          <div class="layui-form-item">
            <div class="layui-inline">
              <label for="title" class="layui-form-label">
                <span class="x-red">*</span>考试时间
              </label>
              <div class="layui-input-inline">
                  <input type="text" class="layui-input" id="bfdate" name="bfdate" placeholder="开始时间" value="{$list.data.bfdate|default=''}" autocomplete="off">
              </div>
              <div class="layui-input-inline">
                  <input type="text" class="layui-input" id="enddate" name="enddate" placeholder="结束时间" value="{$list.data.enddate|default=''}" autocomplete="off">
              </div>
            </div>
          </div>
          <div class="layui-form-item" style="text-align: right;">
              <button  class="layui-btn" lay-filter="mysubmit" lay-submit="">
                  {$list.set.butname}
              </button>
          </div>
      </form>
{/block}

{block name="myjs"}
<script>

  layui.use('laydate', function(){
    var laydate = layui.laydate;
    //开始时间
    laydate.render({
      elem: '#bfdate'
      ,type: 'datetime'
      ,trigger: 'click' //采用click弹出
      ,min: 0 //今天
      ,max: 20 //20天后
      ,format: 'yyyy-M-d' //可任意组合
    });
    //结束时间
    laydate.render({
      elem: '#enddate'
      ,type: 'datetime'
      ,trigger: 'click' //采用click弹出
      ,min: 0 //今天
      ,max: 20 //20天后
      ,format: 'yyyy-M-d' //可任意组合
    });
  });

</script>
{/block}

